﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using Bricks.Data;

namespace Bricks.EntityFramework.Data
{

    /// <summary>
    /// 
    /// </summary>
    public interface IDbContextContextFacade : IContextFacade<DbContext>
    {

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        int Count<TEntity>(Func<IQueryable<TEntity>, IQueryable<TEntity>> predicate) where TEntity : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        IEnumerable<TEntity> Query<TEntity>(Func<IQueryable<TEntity>, IQueryable<TEntity>> predicate) where TEntity : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="predicate"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        PagedResult<TEntity> Query<TEntity>(Func<IQueryable<TEntity>, IQueryable<TEntity>> predicate, int pageIndex, int pageSize) where TEntity : class;

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="predicate"></param>
        /// <returns></returns>
        TEntity QuerySingle<TEntity>(Func<IQueryable<TEntity>, IQueryable<TEntity>> predicate) where TEntity : class;
    }
}
